import { notFound } from 'next/navigation'; import { allPosts } from 'contentlayer/generated'; import Mdx from '@/components/MDX'; import Ad from '@/components/Ad'; import Link from '@/components/Link'; import Icon from '@/components/Icon'; import { blogEnabled } from '@/config/site'; interface PageProps { params: { slug: string; }; } async function getPageFromParams(params) { const slug = params?.slug, page = allPosts.find((page) => page.slugAsParams === slug); if (!page) { null; } return page; } export async function generateStaticParams(): Promise { return allPosts.map((page) => ({ slug: page.slugAsParams, })); } export default async function PostPage({ params }: PageProps) { const post = await getPageFromParams(params); if (!post || !blogEnabled) { notFound(); } return ( <>
{post && post.title && (
{post.product &&
{post.product}
}
July 25, 2023

{post.title}

)}
Go back
{post.description &&

{post.description}

}
); }